[fix] prototype pollution을 통한 Stored XSS 취약점 차단#3072
Closed
chanlee wants to merge 1 commit into
Closed
Conversation
Entry.Scope의 예약어 필터가 문자열 "__proto__"만 차단하여, 배열 ["__proto__"]를 객체 키로 사용할 때 String() 변환으로 우회되는 prototype pollution → Stored XSS 취약점을 수정한다. - scope.js: filterReservedKeywords에서 객체/배열 param을 정규화 후 검사 - block_KKMOO.js: kkmoo 모션 블록 3종의 motnum 인덱스 범위 검증 추가 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines
+32
to
+33
| const normalized = | ||
| typeof param === 'object' && param !== null ? String(param) : param; |
Contributor
There was a problem hiding this comment.
🚫 [eslint] <prettier/prettier> reported by reviewdog 🐶
Delete ⏎···········
Suggested change
| const normalized = | |
| typeof param === 'object' && param !== null ? String(param) : param; | |
| const normalized = typeof param === 'object' && param !== null ? String(param) : param; |
Collaborator
Author
|
#3073과 중복되어 close |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경
유저 제보로 확인된 Stored XSS 취약점입니다. 특정 블록 조합이 포함된 작품을 임의의 사용자가 실행하기만 해도, 작품에 저장된 악성 코드가 prototype pollution을 거쳐 XSS로 실행됩니다.
익스플로잇 체인 (검증 완료)
근본 원인 — 예약어 필터 우회 (
src/playground/scope.js)filterReservedKeywords가Set.has(param)으로 문자열"__proto__"만 차단.["__proto__"]로 넣으면has가false→ 통과.String(["__proto__"]) === "__proto__"로 변환하여 우회.오염 게이트 — kkmoo 하드웨어 블록 (
src/playground/blocks/hardware/block_KKMOO.js)kkmoo_set_frame_time/kkmoo_set_frame/kkmoo_set_motor_degree에서Entry.kkmoo.motionFrame[motnum]등을 인덱스 검증 없이 사용.motnum이 배열이면motionFrame["__proto__"]→Array.prototype접근 →Array.prototype.time오염.Sink — DOM innerHTML
Array.prototype.time이 davinci 블록 실행 흐름을 거쳐 모든 배열의.time으로 노출.time.entity.parent.scene.inputWrapper.innerHTML에<img src=x onerror=...>페이로드가 들어가 Stored XSS 실행.수정 내용
1. (근본)
src/playground/scope.jsfilterReservedKeywords에서 param이 객체/배열이면String()으로 정규화한 뒤 예약어와 비교. 한 곳 수정으로getParam/getParams/getField전 경로의 우회를 차단.__proto__만 유지(호환성 우선). 정상 문자열·숫자·객체 param은 영향 없음.2. (심층)
src/playground/blocks/hardware/block_KKMOO.js오염 게이트였던 kkmoo 모션 블록 3종에서
motnum을Number()로 강제하고 배열 범위를 검증한 뒤에만 인덱싱. 범위 밖이면 무시.검증
filterReservedKeywords단위 검증 통과 —"__proto__"/["__proto__"]→"", 정상값은 원본 유지node --check문법 검증 통과Tests: 0 total) — 본 변경과 무관한 환경 문제남은 권고
__proto__만 차단(호환성 우선).constructor/prototype키 변형은 추후 영향도 점검 후 별도 강화 검토 권장.🤖 Generated with Claude Code